                                # 动手试一试
# 4-1 喜欢的食物
MyFavoriteFood = [ '火锅', '烧烤', '川菜']
for FoodItem in MyFavoriteFood :
    print( "我喜欢吃" + FoodItem )
print( "我是个吃货！" )
# 4-2 喜欢的动物
MyFavoriteAnimals = [ 'dog', 'cat', 'fish', 'duck', 'elephant', 'shark', 'mouse' ]
for animal in MyFavoriteAnimals :
    print( "A " + animal + " would make a great pet." )
print( "Any of these animals would make a great pet!" )
# 4-3 数到20
CountTo20 = [ val for val in range(1, 21) ]
print( CountTo20 )
# 4-4 一千
CountToKilo = [ val for val in range(1, 1001) ]
print( sum(CountToKilo) )
# 4-7 3的倍数
MultiplesOf3 = [ val for val in range(3, 31, 3) ]
print( MultiplesOf3 )
# 4-8 立方
Cube1 = []
for val in range(1, 11) :
    Cube1.append( val**3 )  #循环求解
print( Cube1 )
Cube2 = [ val**3 for val in range(1, 11) ]  #列表解析
print( Cube2 )
# 4-10 切片
print( "The first three items in the list are:" )
print( MyFavoriteAnimals[:3] )  #打印前三个元素
print( "Three items from the middle in the list are:" )
print( MyFavoriteAnimals[ int((len(MyFavoriteAnimals)/2 - 1)) : int((len(MyFavoriteAnimals)/2 + 2)) ] )  #打印中间三个元素
print( "The last three items in the list are:" )
print( MyFavoriteAnimals[-3: ] )
# 4-11 你的食物和我的食物
FriendFavoriteFood = MyFavoriteFood[ : ]
MyFavoriteFood.append( "雪糕" )
FriendFavoriteFood.append( "麻辣烫" )
print( "我最喜欢吃：" )
for myfood in MyFavoriteFood :
    print( myfood )
print( "我朋友最喜欢吃：" )
for friendfood in FriendFavoriteFood :
    print( friendfood )
# 自助餐
print( "\n" )
Foods = ( '麻辣小龙虾', '南瓜饼', '奶茶', '草莓圣代', '蛋糕' )
for food in Foods :
    print( food )
Foods = ( '麻辣小龙虾', '红豆饼', '奶茶', '蓝莓圣代', '蛋糕' )
print( "\n菜单更新：" )
for food in Foods :
    print( food )